package com.yjt.fresh.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.yjt.fresh.R;
import com.yjt.fresh.base.BaseSimpleActivity;
import com.yjt.fresh.bean.BeanAdvert;
import com.yjt.fresh.constant.MyConstants;

import butterknife.BindView;
import butterknife.ButterKnife;
import im.delight.android.webview.AdvancedWebView;

/**
 * Created by UPC on 2018/8/20.
 */

public class AtyBanner extends BaseSimpleActivity {
    @BindView(R.id.back)
    RelativeLayout mBack;
    @BindView(R.id.tvAtyBannerTitle)
    TextView mTvTitle;
    @BindView(R.id.webviewAtyBanner)
    AdvancedWebView mWebview;

    @Override
    protected int getContentView() {
        return R.layout.app_aty_banner;
    }

    @Override
    protected void initViews() {
        ButterKnife.bind(this);
        BeanAdvert beanAdvert = (BeanAdvert) getIntent().getSerializableExtra(MyConstants.BANNER_OBJ);
        mTvTitle.setText(beanAdvert.getTITLE());
        if (beanAdvert.getTYPE() == 1){
            mWebview.loadUrl(beanAdvert.getSKIP_URL());
        }else if (beanAdvert.getTYPE() == 2){
            mWebview.loadHtml(beanAdvert.getCONTENT());
        }
    }

    @Override
    protected void initEvent() {
        mBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });


    }

}
